package string

import (
	"fmt"
	"strings"
	"strconv"
)

func stringTest1() {
	fmt.Println(strings.Contains("seafood", "foo"))
	fmt.Println(strings.Contains("seafood", "bar"))
	fmt.Println(strings.Contains("seafood", ""))
	fmt.Println(strings.Contains("", ""))
}

func stringTest2() {
	s := []string{"foo", "bar", "baz"}
	fmt.Println(strings.Join(s, ", "))
}

func stringTest3()  {
	fmt.Println(strings.Index("chicken", "ken"))
	fmt.Println(strings.Index("chicken", "dmr"))
}

func stringTest4() {
	fmt.Println("ba" + strings.Repeat("na", 2))
}

func stringTest5() {
	fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2))
	fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1))
}

func stringTest6() {
	fmt.Printf("%q\n", strings.Split("a,b,c", ","))
	fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a "))
	fmt.Printf("%q\n", strings.Split(" xyz ", ""))
	fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins"))
}

func stringTest7() {
	fmt.Printf("[%q]", strings.Trim(" !!! Achtung !!! ", "! "))
}

func stringTest8() {
	fmt.Printf("Fields are: %q", strings.Fields("  foo bar  baz   "))
}

func stringTest9() {
	str := make([]byte, 0, 100)
	str = strconv.AppendInt(str, 4567, 10)
	str = strconv.AppendBool(str, false)
	str = strconv.AppendQuote(str, "abcdefg")
	str = strconv.AppendQuoteRune(str, '单')
	fmt.Println(string(str))
}

func stringTest10() {
	a := strconv.FormatBool(false)
	b := strconv.FormatFloat(123.23, 'g', 12, 64)
	c := strconv.FormatInt(1234, 10)
	d := strconv.FormatUint(12345, 10)
	e := strconv.Itoa(1023)
	fmt.Println(a, b, c, d, e)
}

func stringTest11()  {
	a, _ := strconv.ParseBool("false")

	b, _ := strconv.ParseFloat("123.23", 64)

	c, _ := strconv.ParseInt("1234", 10, 64)

	d, _ := strconv.ParseUint("12345", 10, 64)

	e, _ := strconv.Atoi("1023")

	fmt.Println(a, b, c, d, e)
}
func String() {
	stringTest11()
}

